<!DOCTYPE html>
<html lang="zh-Hans">
<head>
    @import "mate.html"
    <title>农业后台系统1</title>
    <link rel="stylesheet" href="../assets/layui/css/layui.css">
    <!--<link rel="stylesheet" href="../assets/zTree/css/zTreeStyle/zTreeStyle.css">-->
    <link rel="stylesheet" href="../css/style.min.css">
</head>
<body class="body">
<div class="processing-detail com-inputs-info">
    <div class="com-btn-group">
        <button id="btn-add" class="y-btn y-btn-add" type="button"><span>添加</span></button>
        <button id="btn-delete" class="y-btn y-btn-delete" type="button"><span>删除</span></button>
    </div>
    <div class="com-table-group">
        <table class="com-table">
            <thead class="thead">
            <tr>
                <td><span><input type="checkbox" id="checkall"></span></td>
                <td><span>公司编号</span></td>
                <td><span>公司名称</span></td>
                <td><span>货品编号</span></td>
                <td><span>创建时间</span></td>
            </tr>
            </thead>
            <tbody class="tbody"></tbody>
        </table>
    </div>
</div>
@import "footer.html"
<!--<script src="../assets/zTree/js/jquery.ztree.all.min.js"></script>-->
<script>
  $(function () {
    $.ajax({
      url: '../assets/json/table-tbody.json',
      type: 'get',
      dataType: 'json',
      success: function (data) {
        var list = data.list, html = '';
        for (var i = 0; i < 6; i++) {
          html += '<tr><td><span><input type="checkbox" data-id=' + list[0].cid + '></span></td>' +
            '<td><span class="text-center">' + list[0].cid + '</span></td>' +
            '<td><span class="limit-words-more" title=' + list[i].cname + '>' + list[i].cname + '</span></td>' +
            '<td><span class="tbody-img"><img src="' + list[0].pimg + '" alt=""></span></td>' +
            '<td><span class="text-center">' + list[i].addtime + '</span></td></tr>';
        }
        $('tbody.tbody').html('').append(html);
      },
      complete: function () {
        photos('.tbody-img');
      }
    });
    var layer = layui.layer,
      oInput = null;
//      添加按钮
    $('#btn-add').on('click', function (e) {
      e.stopPropagation();
      var body;
      dialogShow('详细信息', 'pprojectsadd.html', [600, 500], {
        success: function (obj, index) {
          body = layer.getChildFrame('body', index);
        },
        btn: ['提交', '取消'],
        yes: function () {

        }
      });

    });
//      删除按钮
    $('#btn-delete').on('click', function (e) {
      e.stopPropagation();
      oInput = $('table.com-table').find('input:checked');
      if (oInput.length === 0) {
        errorMsg('请至少选择一条需要打印的数据！');
      } else {
        var body;
        dialogShow('详细信息', 'syprocessingAudit.html', [1000, 600], {
          success: function (obj, index) {
            body = layer.getChildFrame('body', index);
          },
          btn: ['提交', '取消'],
          yes: function () {

          }
        });
      }
    });

//      表格内详情按钮
    var tbody = $('tbody.tbody');
    tbody.on('click', 'button.y-btn-detail', function (e) {
      e.stopPropagation();
      var body;
      dialogShow('详情', 'syprocessingDetail.html', [1000, 650], {
        success: function (obj, index) {
          body = layer.getChildFrame('body', index);
        }
      });
    });

  });
</script>
</body>
</html>